fix possible memory leak if one of the kmalloc fail.
authorvhanquez@kneesa.uk.xensource.com <vhanquez@kneesa.uk.xensource.com>
Sat, 31 Dec 2005 20:17:45 +0000 (20:17 +0000)
committervhanquez@kneesa.uk.xensource.com <vhanquez@kneesa.uk.xensource.com>
Sat, 31 Dec 2005 20:17:45 +0000 (20:17 +0000)
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c

index 9228cb51900875478f920bce5b0512ee49a147ab..34d3399a8e2c0a2449d18b2d577e33d4273dae4e 100644 (file)
@@ -540,6 +540,9 @@ static int __init blkif_init(void)
        pending_vaddrs        = kmalloc(sizeof(pending_vaddrs[0]) *
                                        mmap_pages, GFP_KERNEL);
        if (!pending_reqs || !pending_grant_handles || !pending_vaddrs) {
+               kfree(pending_reqs);
+               kfree(pending_grant_handles);
+               kfree(pending_vaddrs);
                printk("%s: out of memory\n", __FUNCTION__);
                return -1;
        }